package bigoo.peer;

import eduni.simjava.Sim_port;

public class PeerInfo {
    protected String peerID;
    private Sim_port port;

    public PeerInfo(String peerID, Sim_port port) {
	this.peerID = peerID;
	this.port = port;
    }

    public String getPeerID() {
	return peerID;
    }

    public Sim_port getPort() {
	return port;
    }

    @Override
    public int hashCode() {
	final int prime = 31;
	int result = 1;
	result = prime * result + ((peerID == null) ? 0 : peerID.hashCode());
	return result;
    }

    @Override
    public boolean equals(Object obj) {
	if (this == obj)
	    return true;
	if (obj == null)
	    return false;
	if (getClass() != obj.getClass())
	    return false;
	PeerInfo other = (PeerInfo) obj;
	if (peerID == null) {
	    if (other.peerID != null)
		return false;
	} else if (!peerID.equals(other.peerID))
	    return false;
	return true;
    }
    
    @Override
    public String toString() {
	return this.getPeerID();
    }
}